Skip to content

fix: Add SRPoint and SRRectangleROI sub-types#112

Merged
igoroctaviano merged 6 commits intomasterfrom
feat/sr-changes
Apr 1, 2026
Merged

fix: Add SRPoint and SRRectangleROI sub-types#112
igoroctaviano merged 6 commits intomasterfrom
feat/sr-changes

Conversation

@igoroctaviano
Copy link
Copy Markdown
Collaborator

@igoroctaviano igoroctaviano commented Apr 1, 2026

Original Upstream PR: OHIF#5858

New point tool for scoord3d points:

Screenshot 2026-03-09 at 15 21 54 Screenshot 2026-02-27 at 10 19 04

Context

Fixes #107

Improves DICOM SR annotation visualization. Per maintainer feedback: create sub-types of Probe and RectangleROI with custom configuration rather than modifying base tools. SRPoint and SRRectangleROI show the semantic label (e.g. "Lesion" from Finding concept) instead of intensity/coordinates or area/stats, and are used only for SR hydration—they do not replace Probe/RectangleROI in the toolbar.

Client feedback addressed:

  • Point annotations (Probe): Show label instead of intensity/coordinates; render as compact cross (plus) marker per medical imaging convention; make annotations locked (non-movable).
  • Bounding box annotations (RectangleROI): Show label matching right panel; area/intensity stats off by default; make annotations locked.

Changes & Results

New SR subtypes

  • SRPoint – sub-type of Probe; custom SRPointTool renders a compact cross marker; getSRPointTextLines returns only the label.
  • SRRectangleROI – sub-type of RectangleROI; getSRRectangleROITextLines returns only the label.

Files added

  • extensions/cornerstone-dicom-sr/src/tools/SRPointTool.ts – extends ProbeTool with custom renderAnnotation that draws a cross (plus) via drawPath; compact size (6px), reduced text padding.
  • extensions/cornerstone-dicom-sr/src/utils/srToolGetTextLines.ts – getTextLines implementations for SR subtypes.

Files modified

  • extensions/cornerstone-dicom-sr/src/tools/toolNames.ts – added SRPoint, SRRectangleROI.
  • extensions/cornerstone-dicom-sr/src/init.ts – register SRPointTool and SRRectangleROI tool instances with getTextLines; dashed line styles.
  • extensions/cornerstone-dicom-sr/src/utils/hydrateStructuredReport.ts – use SRPoint/SRRectangleROI as toolNameForRendering when hydrating Probe/RectangleROI; always lock hydrated annotations.
  • extensions/cornerstone-dicom-sr/src/tools/DICOMSRDisplayTool.tsrenderPoint draws cross via drawPath; reduced text box padding (6px).
  • extensions/cornerstone-dicom-sr/src/utils/addSRAnnotation.ts – set isLocked: true and call locking.setAnnotationLocked() for preview annotations.
  • extensions/cornerstone-dicom-sr/src/utils/getLabelFromDCMJSImportedToolData.js – fallback to finding.CodeMeaning for standard DICOM codes (e.g. "Lesion").
  • modes/basic/src/initToolGroups.ts – add SRPoint, SRRectangleROI as passive tools (default, MPR, SRToolGroup).
  • modes/basic-test-mode/src/initToolGroups.ts – same.
  • modes/usAnnotation/src/initToolGroups.js – same.
  • extensions/cornerstone/src/utils/measurementServiceMappings/measurementServiceMappingsFactory.ts – SRPoint → POINT, SRRectangleROI → RECTANGLE.
  • extensions/cornerstone/src/initMeasurementService.ts – add SRPoint, SRRectangleROI to supported tools.
  • extensions/cornerstone/src/utils/measurementServiceMappings/constants/supportedTools.js – add SRPoint, SRRectangleROI.

Design decisions

  • Probe and RectangleROI remain in the toolbar; SRPoint and SRRectangleROI are passive tools for hydration display only.
  • Base ProbeTool and RectangleROITool unchanged; only subtypes added.
  • Point markers use cross (plus) shape per medical imaging convention (e.g. 3D Slicer Cross2D); compact size and reduced padding for minimal dead space.

Testing

  1. Load a study with DICOM SR measurements (SCOORD point and/or SCOORD rectangle).
  2. Hydrate the SR display set.
  3. Verify point annotations show label (e.g. "Lesion") and a compact cross marker instead of intensity/coordinates.
  4. Verify rectangle annotations show label instead of area/intensity stats.
  5. Verify all SR annotations are locked (non-movable).
  6. Verify Probe and RectangleROI still appear and work in the toolbar for user-created annotations.

E2E snapshots may need regeneration for Scoord3dProbe, ScoordRectangle:

cd Viewers && cross-env TEST_ENV=true npx playwright test tests/Scoord3dProbe.spec.ts tests/ScoordRectangle.spec.ts --update-snapshots

Before: Point annotations showed intensity/coordinates; rectangle showed area/stats.
After: Point annotations show label + compact cross marker; rectangle shows label only; all SR annotations locked.

Checklist

PR

  • My Pull Request title is descriptive, accurate and follows the
    semantic-release format and guidelines.

Suggested PR title: feat(cornerstone-dicom-sr): add SRPoint and SRRectangleROI subtypes for label-only SR hydration with cross markers

Code

  • My code has been well-documented (function documentation, inline comments,
    etc.)

Public Documentation Updates

  • The documentation page has been updated as necessary for any public API
    additions or removals. (N/A – internal extension tools only)

Tested Environment

  • OS: macOS 14.x (darwin 24.6.0)
  • Node version: 18.x / 20.x
  • Browser: Chrome (latest), Safari (latest)

@igoroctaviano igoroctaviano merged commit 71eb4e0 into master Apr 1, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit visualization of planar annotations from SR

1 participant